﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.GameContent.UI;
using Terraria.ID;
using Terraria.Localization;

namespace Terraria.ModLoader
{
	// Token: 0x02000212 RID: 530
	public static class NPCLoader
	{
		// Token: 0x06001732 RID: 5938 RVA: 0x00417B5C File Offset: 0x00415D5C
		private static NPCLoader.HookList AddHook<F>(Expression<Func<GlobalNPC, F>> func)
		{
			NPCLoader.HookList hookList = new NPCLoader.HookList(ModLoader.Method<GlobalNPC, F>(func));
			NPCLoader.hooks.Add(hookList);
			return hookList;
		}

		// Token: 0x06001733 RID: 5939 RVA: 0x00417B84 File Offset: 0x00415D84
		unsafe static NPCLoader()
		{
			NPCLoader.shopToNPC[1] = 17;
			NPCLoader.shopToNPC[2] = 19;
			NPCLoader.shopToNPC[3] = 20;
			NPCLoader.shopToNPC[4] = 38;
			NPCLoader.shopToNPC[5] = 54;
			NPCLoader.shopToNPC[6] = 107;
			NPCLoader.shopToNPC[7] = 108;
			NPCLoader.shopToNPC[8] = 124;
			NPCLoader.shopToNPC[9] = 142;
			NPCLoader.shopToNPC[10] = 160;
			NPCLoader.shopToNPC[11] = 178;
			NPCLoader.shopToNPC[12] = 207;
			NPCLoader.shopToNPC[13] = 208;
			NPCLoader.shopToNPC[14] = 209;
			NPCLoader.shopToNPC[15] = 227;
			NPCLoader.shopToNPC[16] = 228;
			NPCLoader.shopToNPC[17] = 229;
			NPCLoader.shopToNPC[18] = 353;
			NPCLoader.shopToNPC[19] = 368;
			NPCLoader.shopToNPC[20] = 453;
			NPCLoader.shopToNPC[21] = 550;
		}

		// Token: 0x06001734 RID: 5940 RVA: 0x00419C18 File Offset: 0x00417E18
		internal static int ReserveNPCID()
		{
			if (ModNet.AllowVanillaClients)
			{
				throw new Exception("Adding npcs breaks vanilla client compatiblity");
			}
			int result = NPCLoader.nextNPC;
			NPCLoader.nextNPC++;
			return result;
		}

		// Token: 0x170001B6 RID: 438
		// (get) Token: 0x06001735 RID: 5941 RVA: 0x00011B48 File Offset: 0x0000FD48
		public static int NPCCount
		{
			get
			{
				return NPCLoader.nextNPC;
			}
		}

		// Token: 0x06001736 RID: 5942 RVA: 0x00011B4F File Offset: 0x0000FD4F
		public static ModNPC GetNPC(int type)
		{
			if (type < 580 || type >= NPCLoader.NPCCount)
			{
				return null;
			}
			return NPCLoader.npcs[type - 580];
		}

		// Token: 0x06001737 RID: 5943 RVA: 0x00419C4C File Offset: 0x00417E4C
		internal static void ResizeArrays(bool unloading)
		{
			Array.Resize<bool>(ref Main.NPCLoaded, NPCLoader.nextNPC);
			Array.Resize<bool>(ref Main.townNPCCanSpawn, NPCLoader.nextNPC);
			Array.Resize<bool>(ref Main.slimeRainNPC, NPCLoader.nextNPC);
			Array.Resize<Texture2D>(ref Main.npcTexture, NPCLoader.nextNPC);
			Array.Resize<Texture2D[]>(ref Main.npcAltTextures, NPCLoader.nextNPC);
			Array.Resize<bool>(ref Main.npcCatchable, NPCLoader.nextNPC);
			Array.Resize<int>(ref Main.npcFrameCount, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPC.killCount, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPC.npcsFoundForCheckActive, NPCLoader.nextNPC);
			Array.Resize<LocalizedText>(ref Lang._npcNameCache, NPCLoader.nextNPC);
			Array.Resize<int>(ref EmoteBubble.CountNPCs, NPCLoader.nextNPC);
			Array.Resize<bool>(ref WorldGen.TownManager._hasRoom, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.TrailingMode, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.BelongsToInvasionOldOnesArmy, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.TeleportationImmune, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.UsesNewTargetting, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.FighterUsesDD2PortalAppearEffect, NPCLoader.nextNPC);
			Array.Resize<float>(ref NPCID.Sets.StatueSpawnedDropRarity, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.NeedsExpertScaling, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.ProjectileNPC, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.SavesAndLoads, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.TrailCacheLength, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.MPAllowedEnemies, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.TownCritter, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.HatOffsetY, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.FaceEmote, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.ExtraFramesCount, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.AttackFrameCount, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.DangerDetectRange, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.AttackTime, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.AttackAverageChance, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.AttackType, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.PrettySafe, NPCLoader.nextNPC);
			Array.Resize<Color>(ref NPCID.Sets.MagicAuraColor, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.BossHeadTextures, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.ExcludedFromDeathTally, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.TechnicallyABoss, NPCLoader.nextNPC);
			Array.Resize<bool>(ref NPCID.Sets.MustAlwaysDraw, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.ExtraTextureCount, NPCLoader.nextNPC);
			Array.Resize<int>(ref NPCID.Sets.NPCFramingGroup, NPCLoader.nextNPC);
			Array.Resize<int[]>(ref NPCID.Sets.TownNPCsFramingGroups, NPCLoader.nextNPC);
			for (int i = 580; i < NPCLoader.nextNPC; i++)
			{
				Main.NPCLoaded[i] = true;
				Main.npcFrameCount[i] = 1;
				Lang._npcNameCache[i] = LocalizedText.Empty;
				NPCID.Sets.TrailingMode[i] = -1;
				NPCID.Sets.StatueSpawnedDropRarity[i] = -1f;
				NPCID.Sets.TrailCacheLength[i] = 10;
				NPCID.Sets.DangerDetectRange[i] = -1;
				NPCID.Sets.AttackTime[i] = -1;
				NPCID.Sets.AttackAverageChance[i] = 1;
				NPCID.Sets.AttackType[i] = -1;
				NPCID.Sets.PrettySafe[i] = -1;
				NPCID.Sets.MagicAuraColor[i] = Color.White;
				NPCID.Sets.BossHeadTextures[i] = -1;
			}
			NPCLoader.InstancedGlobals = (from g in NPCLoader.globalNPCs
			where g.InstancePerEntity
			select g).ToArray<GlobalNPC>();
			for (int j = 0; j < NPCLoader.InstancedGlobals.Length; j++)
			{
				NPCLoader.InstancedGlobals[j].instanceIndex = j;
			}
			foreach (NPCLoader.HookList hookList in NPCLoader.hooks)
			{
				hookList.arr = ModLoader.BuildGlobalHook<GlobalNPC>(NPCLoader.globalNPCs, hookList.method);
			}
			if (!unloading)
			{
				NPCLoader.loaded = true;
			}
		}

		// Token: 0x06001738 RID: 5944 RVA: 0x0041A014 File Offset: 0x00418214
		internal static void Unload()
		{
			NPCLoader.loaded = false;
			NPCLoader.npcs.Clear();
			NPCLoader.nextNPC = 580;
			NPCLoader.globalNPCs.Clear();
			NPCLoader.globalIndexes.Clear();
			NPCLoader.globalIndexesByType.Clear();
			NPCLoader.bannerToItem.Clear();
			while (NPCID.Sets.Skeletons.Count > NPCLoader.vanillaSkeletonCount)
			{
				NPCID.Sets.Skeletons.RemoveAt(NPCID.Sets.Skeletons.Count - 1);
			}
		}

		// Token: 0x06001739 RID: 5945 RVA: 0x00011B74 File Offset: 0x0000FD74
		internal static bool IsModNPC(NPC npc)
		{
			return npc.type >= 580;
		}

		// Token: 0x0600173A RID: 5946 RVA: 0x0041A08C File Offset: 0x0041828C
		internal static void SetDefaults(NPC npc, bool createModNPC = true)
		{
			if (NPCLoader.IsModNPC(npc))
			{
				if (createModNPC)
				{
					npc.modNPC = NPCLoader.GetNPC(npc.type).NewInstance(npc);
				}
				else
				{
					Array.Resize<bool>(ref npc.buffImmune, BuffLoader.BuffCount);
				}
			}
			npc.globalNPCs = (from g in NPCLoader.InstancedGlobals
			select g.NewInstance(npc)).ToArray<GlobalNPC>();
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.SetDefaults();
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookSetDefaults.arr)
			{
				globalNPC.Instance(npc).SetDefaults(npc);
			}
		}

		// Token: 0x0600173B RID: 5947 RVA: 0x0041A164 File Offset: 0x00418364
		internal static GlobalNPC GetGlobalNPC(NPC npc, Mod mod, string name)
		{
			int index;
			if (!NPCLoader.globalIndexes.TryGetValue(mod.Name + ":" + name, out index))
			{
				return null;
			}
			return NPCLoader.globalNPCs[index].Instance(npc);
		}

		// Token: 0x0600173C RID: 5948 RVA: 0x0041A1A4 File Offset: 0x004183A4
		internal static GlobalNPC GetGlobalNPC(NPC npc, Type type)
		{
			int num;
			if (!NPCLoader.globalIndexesByType.TryGetValue(type, out num))
			{
				return null;
			}
			if (num <= -1)
			{
				return null;
			}
			return NPCLoader.globalNPCs[num].Instance(npc);
		}

		// Token: 0x0600173D RID: 5949 RVA: 0x0041A1DC File Offset: 0x004183DC
		public static void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.ScaleExpertStats(numPlayers, bossLifeScale);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookScaleExpertStats.arr)
			{
				globalNPC.Instance(npc).ScaleExpertStats(npc, numPlayers, bossLifeScale);
			}
		}

		// Token: 0x0600173E RID: 5950 RVA: 0x0041A228 File Offset: 0x00418428
		public static void ResetEffects(NPC npc)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.ResetEffects();
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookResetEffects.arr)
			{
				globalNPC.Instance(npc).ResetEffects(npc);
			}
		}

		// Token: 0x0600173F RID: 5951 RVA: 0x0041A270 File Offset: 0x00418470
		public static void NPCAI(NPC npc)
		{
			if (NPCLoader.PreAI(npc))
			{
				int type = npc.type;
				bool flag = npc.modNPC != null && npc.modNPC.aiType > 0;
				if (flag)
				{
					npc.type = npc.modNPC.aiType;
				}
				npc.VanillaAI();
				if (flag)
				{
					npc.type = type;
				}
				NPCLoader.AI(npc);
			}
			NPCLoader.PostAI(npc);
		}

		// Token: 0x06001740 RID: 5952 RVA: 0x0041A2D8 File Offset: 0x004184D8
		public static bool PreAI(NPC npc)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookPreAI.arr)
			{
				if (!globalNPC.Instance(npc).PreAI(npc))
				{
					return false;
				}
			}
			return npc.modNPC == null || npc.modNPC.PreAI();
		}

		// Token: 0x06001741 RID: 5953 RVA: 0x0041A328 File Offset: 0x00418528
		public static void AI(NPC npc)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.AI();
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookAI.arr)
			{
				globalNPC.Instance(npc).AI(npc);
			}
		}

		// Token: 0x06001742 RID: 5954 RVA: 0x0041A370 File Offset: 0x00418570
		public static void PostAI(NPC npc)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.PostAI();
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookPostAI.arr)
			{
				globalNPC.Instance(npc).PostAI(npc);
			}
		}

		// Token: 0x06001743 RID: 5955 RVA: 0x0041A3B8 File Offset: 0x004185B8
		public static void SendExtraAI(NPC npc, BinaryWriter writer)
		{
			if (npc.modNPC != null)
			{
				byte[] array;
				using (MemoryStream memoryStream = new MemoryStream())
				{
					using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
					{
						npc.modNPC.SendExtraAI(binaryWriter);
						binaryWriter.Flush();
						array = memoryStream.ToArray();
					}
				}
				writer.Write((byte)array.Length);
				if (array.Length != 0)
				{
					writer.Write(array);
				}
			}
		}

		// Token: 0x06001744 RID: 5956 RVA: 0x0041A43C File Offset: 0x0041863C
		public static void ReceiveExtraAI(NPC npc, BinaryReader reader)
		{
			if (npc.modNPC != null)
			{
				byte[] array = reader.ReadBytes((int)reader.ReadByte());
				if (array.Length != 0)
				{
					using (MemoryStream memoryStream = new MemoryStream(array))
					{
						using (BinaryReader binaryReader = new BinaryReader(memoryStream))
						{
							npc.modNPC.ReceiveExtraAI(binaryReader);
						}
					}
				}
			}
		}

		// Token: 0x06001745 RID: 5957 RVA: 0x0041A4B0 File Offset: 0x004186B0
		public static void FindFrame(NPC npc, int frameHeight)
		{
			int type = npc.type;
			if (npc.modNPC != null && npc.modNPC.animationType > 0)
			{
				npc.type = npc.modNPC.animationType;
			}
			npc.VanillaFindFrame(frameHeight);
			npc.type = type;
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.FindFrame(frameHeight);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookFindFrame.arr)
			{
				globalNPC.Instance(npc).FindFrame(npc, frameHeight);
			}
		}

		// Token: 0x06001746 RID: 5958 RVA: 0x0041A538 File Offset: 0x00418738
		public static void HitEffect(NPC npc, int hitDirection, double damage)
		{
			npc.VanillaHitEffect(hitDirection, damage);
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.HitEffect(hitDirection, damage);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookHitEffect.arr)
			{
				globalNPC.Instance(npc).HitEffect(npc, hitDirection, damage);
			}
		}

		// Token: 0x06001747 RID: 5959 RVA: 0x0041A58C File Offset: 0x0041878C
		public static void UpdateLifeRegen(NPC npc, ref int damage)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.UpdateLifeRegen(ref damage);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookUpdateLifeRegen.arr)
			{
				globalNPC.Instance(npc).UpdateLifeRegen(npc, ref damage);
			}
		}

		// Token: 0x06001748 RID: 5960 RVA: 0x0041A5D8 File Offset: 0x004187D8
		public static bool CheckActive(NPC npc)
		{
			if (npc.modNPC != null && !npc.modNPC.CheckActive())
			{
				return false;
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookCheckActive.arr)
			{
				if (!globalNPC.Instance(npc).CheckActive(npc))
				{
					return false;
				}
			}
			return true;
		}

		// Token: 0x06001749 RID: 5961 RVA: 0x0041A62C File Offset: 0x0041882C
		public static bool CheckDead(NPC npc)
		{
			if (npc.modNPC != null && !npc.modNPC.CheckDead())
			{
				return false;
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookCheckDead.arr)
			{
				if (!globalNPC.Instance(npc).CheckDead(npc))
				{
					return false;
				}
			}
			return true;
		}

		// Token: 0x0600174A RID: 5962 RVA: 0x0041A680 File Offset: 0x00418880
		public static bool SpecialNPCLoot(NPC npc)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookSpecialNPCLoot.arr)
			{
				if (globalNPC.Instance(npc).SpecialNPCLoot(npc))
				{
					return true;
				}
			}
			return npc.modNPC != null && npc.modNPC.SpecialNPCLoot();
		}

		// Token: 0x0600174B RID: 5963 RVA: 0x0041A6D0 File Offset: 0x004188D0
		public static bool PreNPCLoot(NPC npc)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookPreNPCLoot.arr)
			{
				if (!globalNPC.Instance(npc).PreNPCLoot(npc))
				{
					NPCLoader.blockLoot.Clear();
					return false;
				}
			}
			if (npc.modNPC != null && !npc.modNPC.PreNPCLoot())
			{
				NPCLoader.blockLoot.Clear();
				return false;
			}
			return true;
		}

		// Token: 0x0600174C RID: 5964 RVA: 0x0041A738 File Offset: 0x00418938
		public static void NPCLoot(NPC npc)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.NPCLoot();
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookNPCLoot.arr)
			{
				globalNPC.Instance(npc).NPCLoot(npc);
			}
			NPCLoader.blockLoot.Clear();
		}

		// Token: 0x0600174D RID: 5965 RVA: 0x00011B86 File Offset: 0x0000FD86
		public static void BossLoot(NPC npc, ref string name, ref int potionType)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC == null)
			{
				return;
			}
			modNPC.BossLoot(ref name, ref potionType);
		}

		// Token: 0x0600174E RID: 5966 RVA: 0x00011B9A File Offset: 0x0000FD9A
		public static void BossBag(NPC npc, ref int bagType)
		{
			if (npc.modNPC != null)
			{
				bagType = npc.modNPC.bossBag;
			}
		}

		// Token: 0x0600174F RID: 5967 RVA: 0x0041A78C File Offset: 0x0041898C
		public static bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookCanHitPlayer.arr)
			{
				if (!globalNPC.Instance(npc).CanHitPlayer(npc, target, ref cooldownSlot))
				{
					return false;
				}
			}
			return npc.modNPC == null || npc.modNPC.CanHitPlayer(target, ref cooldownSlot);
		}

		// Token: 0x06001750 RID: 5968 RVA: 0x0041A7E0 File Offset: 0x004189E0
		public static void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.ModifyHitPlayer(target, ref damage, ref crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookModifyHitPlayer.arr)
			{
				globalNPC.Instance(npc).ModifyHitPlayer(npc, target, ref damage, ref crit);
			}
		}

		// Token: 0x06001751 RID: 5969 RVA: 0x0041A830 File Offset: 0x00418A30
		public static void OnHitPlayer(NPC npc, Player target, int damage, bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.OnHitPlayer(target, damage, crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookOnHitPlayer.arr)
			{
				globalNPC.Instance(npc).OnHitPlayer(npc, target, damage, crit);
			}
		}

		// Token: 0x06001752 RID: 5970 RVA: 0x0041A880 File Offset: 0x00418A80
		public static bool? CanHitNPC(NPC npc, NPC target)
		{
			bool? result = null;
			foreach (GlobalNPC globalNPC in NPCLoader.HookCanHitNPC.arr)
			{
				bool? flag = globalNPC.Instance(npc).CanHitNPC(npc, target);
				if (flag != null && !flag.Value)
				{
					return new bool?(false);
				}
				if (flag != null)
				{
					result = new bool?(flag.Value);
				}
			}
			if (npc.modNPC != null)
			{
				bool? flag2 = npc.modNPC.CanHitNPC(target);
				if (flag2 != null && !flag2.Value)
				{
					return new bool?(false);
				}
				if (flag2 != null)
				{
					result = new bool?(flag2.Value);
				}
			}
			return result;
		}

		// Token: 0x06001753 RID: 5971 RVA: 0x0041A93C File Offset: 0x00418B3C
		public static void ModifyHitNPC(NPC npc, NPC target, ref int damage, ref float knockback, ref bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.ModifyHitNPC(target, ref damage, ref knockback, ref crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookModifyHitNPC.arr)
			{
				globalNPC.Instance(npc).ModifyHitNPC(npc, target, ref damage, ref knockback, ref crit);
			}
		}

		// Token: 0x06001754 RID: 5972 RVA: 0x0041A990 File Offset: 0x00418B90
		public static void OnHitNPC(NPC npc, NPC target, int damage, float knockback, bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.OnHitNPC(target, damage, knockback, crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookOnHitNPC.arr)
			{
				globalNPC.Instance(npc).OnHitNPC(npc, target, damage, knockback, crit);
			}
		}

		// Token: 0x06001755 RID: 5973 RVA: 0x0041A9E4 File Offset: 0x00418BE4
		public static bool? CanBeHitByItem(NPC npc, Player player, Item item)
		{
			bool? result = null;
			foreach (GlobalNPC globalNPC in NPCLoader.HookCanBeHitByItem.arr)
			{
				bool? flag = globalNPC.Instance(npc).CanBeHitByItem(npc, player, item);
				if (flag != null && !flag.Value)
				{
					return new bool?(false);
				}
				if (flag != null)
				{
					result = new bool?(flag.Value);
				}
			}
			if (npc.modNPC != null)
			{
				bool? flag2 = npc.modNPC.CanBeHitByItem(player, item);
				if (flag2 != null && !flag2.Value)
				{
					return new bool?(false);
				}
				if (flag2 != null)
				{
					result = new bool?(flag2.Value);
				}
			}
			return result;
		}

		// Token: 0x06001756 RID: 5974 RVA: 0x0041AAA0 File Offset: 0x00418CA0
		public static void ModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.ModifyHitByItem(player, item, ref damage, ref knockback, ref crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookModifyHitByItem.arr)
			{
				globalNPC.Instance(npc).ModifyHitByItem(npc, player, item, ref damage, ref knockback, ref crit);
			}
		}

		// Token: 0x06001757 RID: 5975 RVA: 0x0041AAF8 File Offset: 0x00418CF8
		public static void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.OnHitByItem(player, item, damage, knockback, crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookOnHitByItem.arr)
			{
				globalNPC.Instance(npc).OnHitByItem(npc, player, item, damage, knockback, crit);
			}
		}

		// Token: 0x06001758 RID: 5976 RVA: 0x0041AB50 File Offset: 0x00418D50
		public static bool? CanBeHitByProjectile(NPC npc, Projectile projectile)
		{
			bool? result = null;
			foreach (GlobalNPC globalNPC in NPCLoader.HookCanBeHitByProjectile.arr)
			{
				bool? flag = globalNPC.Instance(npc).CanBeHitByProjectile(npc, projectile);
				if (flag != null && !flag.Value)
				{
					return new bool?(false);
				}
				if (flag != null)
				{
					result = new bool?(flag.Value);
				}
			}
			if (npc.modNPC != null)
			{
				bool? flag2 = npc.modNPC.CanBeHitByProjectile(projectile);
				if (flag2 != null && !flag2.Value)
				{
					return new bool?(false);
				}
				if (flag2 != null)
				{
					result = new bool?(flag2.Value);
				}
			}
			return result;
		}

		// Token: 0x06001759 RID: 5977 RVA: 0x0041AC0C File Offset: 0x00418E0C
		public static void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.ModifyHitByProjectile(projectile, ref damage, ref knockback, ref crit, ref hitDirection);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookModifyHitByProjectile.arr)
			{
				globalNPC.Instance(npc).ModifyHitByProjectile(npc, projectile, ref damage, ref knockback, ref crit, ref hitDirection);
			}
		}

		// Token: 0x0600175A RID: 5978 RVA: 0x0041AC64 File Offset: 0x00418E64
		public static void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.OnHitByProjectile(projectile, damage, knockback, crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookOnHitByProjectile.arr)
			{
				globalNPC.Instance(npc).OnHitByProjectile(npc, projectile, damage, knockback, crit);
			}
		}

		// Token: 0x0600175B RID: 5979 RVA: 0x0041ACB8 File Offset: 0x00418EB8
		public static bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
		{
			bool result = true;
			if (npc.modNPC != null)
			{
				result = npc.modNPC.StrikeNPC(ref damage, defense, ref knockback, hitDirection, ref crit);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookStrikeNPC.arr)
			{
				if (!globalNPC.Instance(npc).StrikeNPC(npc, ref damage, defense, ref knockback, hitDirection, ref crit))
				{
					result = false;
				}
			}
			return result;
		}

		// Token: 0x0600175C RID: 5980 RVA: 0x0041AD18 File Offset: 0x00418F18
		public static void BossHeadSlot(NPC npc, ref int index)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.BossHeadSlot(ref index);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookBossHeadSlot.arr)
			{
				globalNPC.Instance(npc).BossHeadSlot(npc, ref index);
			}
		}

		// Token: 0x0600175D RID: 5981 RVA: 0x0041AD64 File Offset: 0x00418F64
		public static void BossHeadRotation(NPC npc, ref float rotation)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.BossHeadRotation(ref rotation);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookBossHeadRotation.arr)
			{
				globalNPC.Instance(npc).BossHeadRotation(npc, ref rotation);
			}
		}

		// Token: 0x0600175E RID: 5982 RVA: 0x0041ADB0 File Offset: 0x00418FB0
		public static void BossHeadSpriteEffects(NPC npc, ref SpriteEffects spriteEffects)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.BossHeadSpriteEffects(ref spriteEffects);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookBossHeadSpriteEffects.arr)
			{
				globalNPC.Instance(npc).BossHeadSpriteEffects(npc, ref spriteEffects);
			}
		}

		// Token: 0x0600175F RID: 5983 RVA: 0x0041ADFC File Offset: 0x00418FFC
		public static Color? GetAlpha(NPC npc, Color lightColor)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookGetAlpha.arr)
			{
				Color? alpha = globalNPC.Instance(npc).GetAlpha(npc, lightColor);
				if (alpha != null)
				{
					return new Color?(alpha.Value);
				}
			}
			ModNPC modNPC = npc.modNPC;
			if (modNPC == null)
			{
				return null;
			}
			return modNPC.GetAlpha(lightColor);
		}

		// Token: 0x06001760 RID: 5984 RVA: 0x0041AE68 File Offset: 0x00419068
		public static void DrawEffects(NPC npc, ref Color drawColor)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.DrawEffects(ref drawColor);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookDrawEffects.arr)
			{
				globalNPC.Instance(npc).DrawEffects(npc, ref drawColor);
			}
		}

		// Token: 0x06001761 RID: 5985 RVA: 0x0041AEB4 File Offset: 0x004190B4
		public static bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookPreDraw.arr)
			{
				if (!globalNPC.Instance(npc).PreDraw(npc, spriteBatch, drawColor))
				{
					return false;
				}
			}
			return npc.modNPC == null || npc.modNPC.PreDraw(spriteBatch, drawColor);
		}

		// Token: 0x06001762 RID: 5986 RVA: 0x0041AF08 File Offset: 0x00419108
		public static void PostDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.PostDraw(spriteBatch, drawColor);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookPostDraw.arr)
			{
				globalNPC.Instance(npc).PostDraw(npc, spriteBatch, drawColor);
			}
		}

		// Token: 0x06001763 RID: 5987 RVA: 0x0041AF54 File Offset: 0x00419154
		public static bool DrawHealthBar(NPC npc, ref float scale)
		{
			Vector2 position = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + npc.gfxOffY);
			if (Main.HealthBarDrawSettings == 1)
			{
				position.Y += (float)npc.height + 10f + Main.NPCAddHeight(npc.whoAmI);
			}
			else if (Main.HealthBarDrawSettings == 2)
			{
				position.Y -= 24f + Main.NPCAddHeight(npc.whoAmI) / 2f;
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookDrawHealthBar.arr)
			{
				bool? flag = globalNPC.Instance(npc).DrawHealthBar(npc, Main.HealthBarDrawSettings, ref scale, ref position);
				if (flag != null)
				{
					if (flag.Value)
					{
						NPCLoader.DrawHealthBar(npc, position, scale);
					}
					return false;
				}
			}
			if (NPCLoader.IsModNPC(npc))
			{
				bool? flag2 = npc.modNPC.DrawHealthBar(Main.HealthBarDrawSettings, ref scale, ref position);
				if (flag2 != null)
				{
					if (flag2.Value)
					{
						NPCLoader.DrawHealthBar(npc, position, scale);
					}
					return false;
				}
			}
			return true;
		}

		// Token: 0x06001764 RID: 5988 RVA: 0x0041B074 File Offset: 0x00419274
		private static void DrawHealthBar(NPC npc, Vector2 position, float scale)
		{
			float alpha = Lighting.Brightness((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f));
			Main.instance.DrawHealthBar(position.X, position.Y, npc.life, npc.lifeMax, alpha, scale);
		}

		// Token: 0x06001765 RID: 5989 RVA: 0x0041B0D0 File Offset: 0x004192D0
		public static void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookEditSpawnRate.arr)
			{
				globalNPC.EditSpawnRate(player, ref spawnRate, ref maxSpawns);
			}
		}

		// Token: 0x06001766 RID: 5990 RVA: 0x0041B104 File Offset: 0x00419304
		public static void EditSpawnRange(Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookEditSpawnRange.arr)
			{
				globalNPC.EditSpawnRange(player, ref spawnRangeX, ref spawnRangeY, ref safeRangeX, ref safeRangeY);
			}
		}

		// Token: 0x06001767 RID: 5991 RVA: 0x0041B13C File Offset: 0x0041933C
		public static int? ChooseSpawn(NPCSpawnInfo spawnInfo)
		{
			NPCSpawnHelper.Reset();
			NPCSpawnHelper.DoChecks(spawnInfo);
			IDictionary<int, float> dictionary = new Dictionary<int, float>();
			dictionary[0] = 1f;
			foreach (ModNPC modNPC in NPCLoader.npcs)
			{
				float num = modNPC.SpawnChance(spawnInfo);
				if (num > 0f)
				{
					dictionary[modNPC.npc.type] = num;
				}
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookEditSpawnPool.arr)
			{
				globalNPC.EditSpawnPool(dictionary, spawnInfo);
			}
			float num2 = 0f;
			foreach (int key in dictionary.Keys)
			{
				if (dictionary[key] < 0f)
				{
					dictionary[key] = 0f;
				}
				num2 += dictionary[key];
			}
			float num3 = (float)Main.rand.NextDouble() * num2;
			foreach (int num4 in dictionary.Keys)
			{
				float num5 = dictionary[num4];
				if (num3 < num5)
				{
					return new int?(num4);
				}
				num3 -= num5;
			}
			return null;
		}

		// Token: 0x06001768 RID: 5992 RVA: 0x0041B2D4 File Offset: 0x004194D4
		public static int SpawnNPC(int type, int tileX, int tileY)
		{
			int num = (type >= 580) ? NPCLoader.GetNPC(type).SpawnNPC(tileX, tileY) : NPC.NewNPC(tileX * 16 + 8, tileY * 16, type, 0, 0f, 0f, 0f, 0f, 255);
			foreach (GlobalNPC globalNPC in NPCLoader.HookSpawnNPC.arr)
			{
				globalNPC.Instance(Main.npc[num]).SpawnNPC(num, tileX, tileY);
			}
			return num;
		}

		// Token: 0x06001769 RID: 5993 RVA: 0x0041B358 File Offset: 0x00419558
		public static void CanTownNPCSpawn(int numTownNPCs, int money)
		{
			foreach (ModNPC modNPC in NPCLoader.npcs)
			{
				if (modNPC.npc.townNPC && NPC.TypeToHeadIndex(modNPC.npc.type) >= 0 && !NPC.AnyNPCs(modNPC.npc.type) && modNPC.CanTownNPCSpawn(numTownNPCs, money))
				{
					Main.townNPCCanSpawn[modNPC.npc.type] = true;
					if (WorldGen.prioritizedTownNPC == 0)
					{
						WorldGen.prioritizedTownNPC = modNPC.npc.type;
					}
				}
			}
		}

		// Token: 0x0600176A RID: 5994 RVA: 0x00011BB1 File Offset: 0x0000FDB1
		public static bool CheckConditions(int type)
		{
			ModNPC npc = NPCLoader.GetNPC(type);
			return npc == null || npc.CheckConditions(WorldGen.roomX1, WorldGen.roomX2, WorldGen.roomY1, WorldGen.roomY2);
		}

		// Token: 0x0600176B RID: 5995 RVA: 0x00011BD8 File Offset: 0x0000FDD8
		public static string TownNPCName(int type)
		{
			ModNPC npc = NPCLoader.GetNPC(type);
			return ((npc != null) ? npc.TownNPCName() : null) ?? "";
		}

		// Token: 0x0600176C RID: 5996 RVA: 0x00011BF5 File Offset: 0x0000FDF5
		public static bool UsesPartyHat(NPC npc)
		{
			ModNPC modNPC = npc.modNPC;
			return modNPC == null || modNPC.UsesPartyHat();
		}

		// Token: 0x0600176D RID: 5997 RVA: 0x0041B404 File Offset: 0x00419604
		public static void GetChat(NPC npc, ref string chat)
		{
			if (npc.modNPC != null)
			{
				chat = npc.modNPC.GetChat();
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookGetChat.arr)
			{
				globalNPC.Instance(npc).GetChat(npc, ref chat);
			}
		}

		// Token: 0x0600176E RID: 5998 RVA: 0x0041B454 File Offset: 0x00419654
		public static void SetChatButtons(ref string button, ref string button2)
		{
			if (Main.player[Main.myPlayer].talkNPC >= 0)
			{
				NPC npc = Main.npc[Main.player[Main.myPlayer].talkNPC];
				ModNPC modNPC = npc.modNPC;
				if (modNPC == null)
				{
					return;
				}
				modNPC.SetChatButtons(ref button, ref button2);
			}
		}

		// Token: 0x0600176F RID: 5999 RVA: 0x0041B4A0 File Offset: 0x004196A0
		public static void OnChatButtonClicked(bool firstButton)
		{
			NPC npc = Main.npc[Main.player[Main.myPlayer].talkNPC];
			if (npc.modNPC != null)
			{
				bool flag = false;
				npc.modNPC.OnChatButtonClicked(firstButton, ref flag);
				Main.PlaySound(12, -1, -1, 1, 1f, 0f);
				if (flag)
				{
					Main.playerInventory = true;
					Main.npcChatText = "";
					Main.npcShop = Main.MaxShopIDs - 1;
					Main.instance.shop[Main.npcShop].SetupShop(npc.type);
				}
			}
		}

		// Token: 0x06001770 RID: 6000 RVA: 0x0041B52C File Offset: 0x0041972C
		public static void SetupShop(int type, Chest shop, ref int nextSlot)
		{
			if (type < NPCLoader.shopToNPC.Length)
			{
				type = NPCLoader.shopToNPC[type];
			}
			else
			{
				ModNPC npc = NPCLoader.GetNPC(type);
				if (npc != null)
				{
					npc.SetupShop(shop, ref nextSlot);
				}
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookSetupShop.arr)
			{
				globalNPC.SetupShop(type, shop, ref nextSlot);
			}
		}

		// Token: 0x06001771 RID: 6001 RVA: 0x0041B588 File Offset: 0x00419788
		public static void SetupTravelShop(int[] shop, ref int nextSlot)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookSetupTravelShop.arr)
			{
				globalNPC.SetupTravelShop(shop, ref nextSlot);
			}
		}

		// Token: 0x06001772 RID: 6002 RVA: 0x0041B5BC File Offset: 0x004197BC
		public static void BuffTownNPC(ref float damageMult, ref int defense)
		{
			foreach (GlobalNPC globalNPC in NPCLoader.HookBuffTownNPC.arr)
			{
				globalNPC.BuffTownNPC(ref damageMult, ref defense);
			}
		}

		// Token: 0x06001773 RID: 6003 RVA: 0x0041B5F0 File Offset: 0x004197F0
		public static void TownNPCAttackStrength(NPC npc, ref int damage, ref float knockback)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackStrength(ref damage, ref knockback);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackStrength.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackStrength(npc, ref damage, ref knockback);
			}
		}

		// Token: 0x06001774 RID: 6004 RVA: 0x0041B63C File Offset: 0x0041983C
		public static void TownNPCAttackCooldown(NPC npc, ref int cooldown, ref int randExtraCooldown)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackCooldown(ref cooldown, ref randExtraCooldown);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackCooldown.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackCooldown(npc, ref cooldown, ref randExtraCooldown);
			}
		}

		// Token: 0x06001775 RID: 6005 RVA: 0x0041B688 File Offset: 0x00419888
		public static void TownNPCAttackProj(NPC npc, ref int projType, ref int attackDelay)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackProj(ref projType, ref attackDelay);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackProj.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackProj(npc, ref projType, ref attackDelay);
			}
		}

		// Token: 0x06001776 RID: 6006 RVA: 0x0041B6D4 File Offset: 0x004198D4
		public static void TownNPCAttackProjSpeed(NPC npc, ref float multiplier, ref float gravityCorrection, ref float randomOffset)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackProjSpeed(ref multiplier, ref gravityCorrection, ref randomOffset);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackProjSpeed.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackProjSpeed(npc, ref multiplier, ref gravityCorrection, ref randomOffset);
			}
		}

		// Token: 0x06001777 RID: 6007 RVA: 0x0041B724 File Offset: 0x00419924
		public static void TownNPCAttackShoot(NPC npc, ref bool inBetweenShots)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackShoot(ref inBetweenShots);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackShoot.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackShoot(npc, ref inBetweenShots);
			}
		}

		// Token: 0x06001778 RID: 6008 RVA: 0x0041B770 File Offset: 0x00419970
		public static void TownNPCAttackMagic(NPC npc, ref float auraLightMultiplier)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackMagic(ref auraLightMultiplier);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackMagic.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackMagic(npc, ref auraLightMultiplier);
			}
		}

		// Token: 0x06001779 RID: 6009 RVA: 0x0041B7BC File Offset: 0x004199BC
		public static void TownNPCAttackSwing(NPC npc, ref int itemWidth, ref int itemHeight)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.TownNPCAttackSwing(ref itemWidth, ref itemHeight);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookTownNPCAttackSwing.arr)
			{
				globalNPC.Instance(npc).TownNPCAttackSwing(npc, ref itemWidth, ref itemHeight);
			}
		}

		// Token: 0x0600177A RID: 6010 RVA: 0x0041B808 File Offset: 0x00419A08
		public static void DrawTownAttackGun(NPC npc, ref float scale, ref int item, ref int closeness)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.DrawTownAttackGun(ref scale, ref item, ref closeness);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookDrawTownAttackGun.arr)
			{
				globalNPC.Instance(npc).DrawTownAttackGun(npc, ref scale, ref item, ref closeness);
			}
		}

		// Token: 0x0600177B RID: 6011 RVA: 0x0041B858 File Offset: 0x00419A58
		public static void DrawTownAttackSwing(NPC npc, ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)
		{
			ModNPC modNPC = npc.modNPC;
			if (modNPC != null)
			{
				modNPC.DrawTownAttackSwing(ref item, ref itemSize, ref scale, ref offset);
			}
			foreach (GlobalNPC globalNPC in NPCLoader.HookDrawTownAttackSwing.arr)
			{
				globalNPC.Instance(npc).DrawTownAttackSwing(npc, ref item, ref itemSize, ref scale, ref offset);
			}
		}

		// Token: 0x0600177C RID: 6012 RVA: 0x00011C08 File Offset: 0x0000FE08
		private static bool HasMethod(Type t, string method, params Type[] args)
		{
			return t.GetMethod(method, args).DeclaringType != typeof(GlobalNPC);
		}

		// Token: 0x0600177D RID: 6013 RVA: 0x0041B8AC File Offset: 0x00419AAC
		internal static void VerifyGlobalNPC(GlobalNPC npc)
		{
			Type type = npc.GetType();
			bool flag = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any((FieldInfo f) => f.DeclaringType != typeof(GlobalNPC));
			if (flag && !npc.InstancePerEntity)
			{
				throw new Exception(type + " has instance fields but does not set InstancePerEntity to true. Either use static fields, or per instance globals");
			}
		}

		// Token: 0x040015F3 RID: 5619
		internal static bool loaded = false;

		// Token: 0x040015F4 RID: 5620
		private static int nextNPC = 580;

		// Token: 0x040015F5 RID: 5621
		internal static readonly IList<ModNPC> npcs = new List<ModNPC>();

		// Token: 0x040015F6 RID: 5622
		internal static readonly IList<GlobalNPC> globalNPCs = new List<GlobalNPC>();

		// Token: 0x040015F7 RID: 5623
		internal static GlobalNPC[] InstancedGlobals = new GlobalNPC[0];

		// Token: 0x040015F8 RID: 5624
		internal static readonly IDictionary<string, int> globalIndexes = new Dictionary<string, int>();

		// Token: 0x040015F9 RID: 5625
		internal static readonly IDictionary<Type, int> globalIndexesByType = new Dictionary<Type, int>();

		// Token: 0x040015FA RID: 5626
		internal static readonly IDictionary<int, int> bannerToItem = new Dictionary<int, int>();

		// Token: 0x040015FB RID: 5627
		private static int vanillaSkeletonCount = NPCID.Sets.Skeletons.Count;

		// Token: 0x040015FC RID: 5628
		private static readonly int[] shopToNPC = new int[Main.MaxShopIDs - 1];

		// Token: 0x040015FD RID: 5629
		public static readonly IList<int> blockLoot = new List<int>();

		// Token: 0x040015FE RID: 5630
		private static List<NPCLoader.HookList> hooks = new List<NPCLoader.HookList>();

		// Token: 0x040015FF RID: 5631
		private static NPCLoader.HookList HookSetDefaults = NPCLoader.AddHook<Action<NPC>>((GlobalNPC g) => (Action<NPC>)Delegate.CreateDelegate(typeof(Action<NPC>), g, methodof(GlobalNPC.SetDefaults(NPC))));

		// Token: 0x04001600 RID: 5632
		private static NPCLoader.HookList HookScaleExpertStats = NPCLoader.AddHook<Action<NPC, int, float>>((GlobalNPC g) => (Action<NPC, int, float>)Delegate.CreateDelegate(typeof(Action<NPC, int, float>), g, methodof(GlobalNPC.ScaleExpertStats(NPC, int, float))));

		// Token: 0x04001601 RID: 5633
		private static NPCLoader.HookList HookResetEffects = NPCLoader.AddHook<Action<NPC>>((GlobalNPC g) => (Action<NPC>)Delegate.CreateDelegate(typeof(Action<NPC>), g, methodof(GlobalNPC.ResetEffects(NPC))));

		// Token: 0x04001602 RID: 5634
		private static NPCLoader.HookList HookPreAI = NPCLoader.AddHook<Func<NPC, bool>>((GlobalNPC g) => (Func<NPC, bool>)Delegate.CreateDelegate(typeof(Func<NPC, bool>), g, methodof(GlobalNPC.PreAI(NPC))));

		// Token: 0x04001603 RID: 5635
		private static NPCLoader.HookList HookAI = NPCLoader.AddHook<Action<NPC>>((GlobalNPC g) => (Action<NPC>)Delegate.CreateDelegate(typeof(Action<NPC>), g, methodof(GlobalNPC.AI(NPC))));

		// Token: 0x04001604 RID: 5636
		private static NPCLoader.HookList HookPostAI = NPCLoader.AddHook<Action<NPC>>((GlobalNPC g) => (Action<NPC>)Delegate.CreateDelegate(typeof(Action<NPC>), g, methodof(GlobalNPC.PostAI(NPC))));

		// Token: 0x04001605 RID: 5637
		private static NPCLoader.HookList HookFindFrame = NPCLoader.AddHook<Action<NPC, int>>((GlobalNPC g) => (Action<NPC, int>)Delegate.CreateDelegate(typeof(Action<NPC, int>), g, methodof(GlobalNPC.FindFrame(NPC, int))));

		// Token: 0x04001606 RID: 5638
		private static NPCLoader.HookList HookHitEffect = NPCLoader.AddHook<Action<NPC, int, double>>((GlobalNPC g) => (Action<NPC, int, double>)Delegate.CreateDelegate(typeof(Action<NPC, int, double>), g, methodof(GlobalNPC.HitEffect(NPC, int, double))));

		// Token: 0x04001607 RID: 5639
		private static NPCLoader.HookList HookUpdateLifeRegen = NPCLoader.AddHook<NPCLoader.DelegateUpdateLifeRegen>((GlobalNPC g) => (NPCLoader.DelegateUpdateLifeRegen)Delegate.CreateDelegate(typeof(NPCLoader.DelegateUpdateLifeRegen), g, methodof(GlobalNPC.UpdateLifeRegen(NPC, int*))));

		// Token: 0x04001608 RID: 5640
		private static NPCLoader.HookList HookCheckActive = NPCLoader.AddHook<Func<NPC, bool>>((GlobalNPC g) => (Func<NPC, bool>)Delegate.CreateDelegate(typeof(Func<NPC, bool>), g, methodof(GlobalNPC.CheckActive(NPC))));

		// Token: 0x04001609 RID: 5641
		private static NPCLoader.HookList HookCheckDead = NPCLoader.AddHook<Func<NPC, bool>>((GlobalNPC g) => (Func<NPC, bool>)Delegate.CreateDelegate(typeof(Func<NPC, bool>), g, methodof(GlobalNPC.CheckDead(NPC))));

		// Token: 0x0400160A RID: 5642
		private static NPCLoader.HookList HookSpecialNPCLoot = NPCLoader.AddHook<Func<NPC, bool>>((GlobalNPC g) => (Func<NPC, bool>)Delegate.CreateDelegate(typeof(Func<NPC, bool>), g, methodof(GlobalNPC.SpecialNPCLoot(NPC))));

		// Token: 0x0400160B RID: 5643
		private static NPCLoader.HookList HookPreNPCLoot = NPCLoader.AddHook<Func<NPC, bool>>((GlobalNPC g) => (Func<NPC, bool>)Delegate.CreateDelegate(typeof(Func<NPC, bool>), g, methodof(GlobalNPC.PreNPCLoot(NPC))));

		// Token: 0x0400160C RID: 5644
		private static NPCLoader.HookList HookNPCLoot = NPCLoader.AddHook<Action<NPC>>((GlobalNPC g) => (Action<NPC>)Delegate.CreateDelegate(typeof(Action<NPC>), g, methodof(GlobalNPC.NPCLoot(NPC))));

		// Token: 0x0400160D RID: 5645
		private static NPCLoader.HookList HookCanHitPlayer = NPCLoader.AddHook<NPCLoader.DelegateCanHitPlayer>((GlobalNPC g) => (NPCLoader.DelegateCanHitPlayer)Delegate.CreateDelegate(typeof(NPCLoader.DelegateCanHitPlayer), g, methodof(GlobalNPC.CanHitPlayer(NPC, Player, int*))));

		// Token: 0x0400160E RID: 5646
		private static NPCLoader.HookList HookModifyHitPlayer = NPCLoader.AddHook<NPCLoader.DelegateModifyHitPlayer>((GlobalNPC g) => (NPCLoader.DelegateModifyHitPlayer)Delegate.CreateDelegate(typeof(NPCLoader.DelegateModifyHitPlayer), g, methodof(GlobalNPC.ModifyHitPlayer(NPC, Player, int*, bool*))));

		// Token: 0x0400160F RID: 5647
		private static NPCLoader.HookList HookOnHitPlayer = NPCLoader.AddHook<Action<NPC, Player, int, bool>>((GlobalNPC g) => (Action<NPC, Player, int, bool>)Delegate.CreateDelegate(typeof(Action<NPC, Player, int, bool>), g, methodof(GlobalNPC.OnHitPlayer(NPC, Player, int, bool))));

		// Token: 0x04001610 RID: 5648
		private static NPCLoader.HookList HookCanHitNPC = NPCLoader.AddHook<Func<NPC, NPC, bool?>>((GlobalNPC g) => (Func<NPC, NPC, bool?>)Delegate.CreateDelegate(typeof(Func<NPC, NPC, bool?>), g, methodof(GlobalNPC.CanHitNPC(NPC, NPC))));

		// Token: 0x04001611 RID: 5649
		private static NPCLoader.HookList HookModifyHitNPC = NPCLoader.AddHook<NPCLoader.DelegateModifyHitNPC>((GlobalNPC g) => (NPCLoader.DelegateModifyHitNPC)Delegate.CreateDelegate(typeof(NPCLoader.DelegateModifyHitNPC), g, methodof(GlobalNPC.ModifyHitNPC(NPC, NPC, int*, float*, bool*))));

		// Token: 0x04001612 RID: 5650
		private static NPCLoader.HookList HookOnHitNPC = NPCLoader.AddHook<Action<NPC, NPC, int, float, bool>>((GlobalNPC g) => (Action<NPC, NPC, int, float, bool>)Delegate.CreateDelegate(typeof(Action<NPC, NPC, int, float, bool>), g, methodof(GlobalNPC.OnHitNPC(NPC, NPC, int, float, bool))));

		// Token: 0x04001613 RID: 5651
		private static NPCLoader.HookList HookCanBeHitByItem = NPCLoader.AddHook<Func<NPC, Player, Item, bool?>>((GlobalNPC g) => (Func<NPC, Player, Item, bool?>)Delegate.CreateDelegate(typeof(Func<NPC, Player, Item, bool?>), g, methodof(GlobalNPC.CanBeHitByItem(NPC, Player, Item))));

		// Token: 0x04001614 RID: 5652
		private static NPCLoader.HookList HookModifyHitByItem = NPCLoader.AddHook<NPCLoader.DelegateModifyHitByItem>((GlobalNPC g) => (NPCLoader.DelegateModifyHitByItem)Delegate.CreateDelegate(typeof(NPCLoader.DelegateModifyHitByItem), g, methodof(GlobalNPC.ModifyHitByItem(NPC, Player, Item, int*, float*, bool*))));

		// Token: 0x04001615 RID: 5653
		private static NPCLoader.HookList HookOnHitByItem = NPCLoader.AddHook<Action<NPC, Player, Item, int, float, bool>>((GlobalNPC g) => (Action<NPC, Player, Item, int, float, bool>)Delegate.CreateDelegate(typeof(Action<NPC, Player, Item, int, float, bool>), g, methodof(GlobalNPC.OnHitByItem(NPC, Player, Item, int, float, bool))));

		// Token: 0x04001616 RID: 5654
		private static NPCLoader.HookList HookCanBeHitByProjectile = NPCLoader.AddHook<Func<NPC, Projectile, bool?>>((GlobalNPC g) => (Func<NPC, Projectile, bool?>)Delegate.CreateDelegate(typeof(Func<NPC, Projectile, bool?>), g, methodof(GlobalNPC.CanBeHitByProjectile(NPC, Projectile))));

		// Token: 0x04001617 RID: 5655
		private static NPCLoader.HookList HookModifyHitByProjectile = NPCLoader.AddHook<NPCLoader.DelegateModifyHitByProjectile>((GlobalNPC g) => (NPCLoader.DelegateModifyHitByProjectile)Delegate.CreateDelegate(typeof(NPCLoader.DelegateModifyHitByProjectile), g, methodof(GlobalNPC.ModifyHitByProjectile(NPC, Projectile, int*, float*, bool*, int*))));

		// Token: 0x04001618 RID: 5656
		private static NPCLoader.HookList HookOnHitByProjectile = NPCLoader.AddHook<Action<NPC, Projectile, int, float, bool>>((GlobalNPC g) => (Action<NPC, Projectile, int, float, bool>)Delegate.CreateDelegate(typeof(Action<NPC, Projectile, int, float, bool>), g, methodof(GlobalNPC.OnHitByProjectile(NPC, Projectile, int, float, bool))));

		// Token: 0x04001619 RID: 5657
		private static NPCLoader.HookList HookStrikeNPC = NPCLoader.AddHook<NPCLoader.DelegateStrikeNPC>((GlobalNPC g) => (NPCLoader.DelegateStrikeNPC)Delegate.CreateDelegate(typeof(NPCLoader.DelegateStrikeNPC), g, methodof(GlobalNPC.StrikeNPC(NPC, double*, int, float*, int, bool*))));

		// Token: 0x0400161A RID: 5658
		private static NPCLoader.HookList HookBossHeadSlot = NPCLoader.AddHook<NPCLoader.DelegateBossHeadSlot>((GlobalNPC g) => (NPCLoader.DelegateBossHeadSlot)Delegate.CreateDelegate(typeof(NPCLoader.DelegateBossHeadSlot), g, methodof(GlobalNPC.BossHeadSlot(NPC, int*))));

		// Token: 0x0400161B RID: 5659
		private static NPCLoader.HookList HookBossHeadRotation = NPCLoader.AddHook<NPCLoader.DelegateBossHeadRotation>((GlobalNPC g) => (NPCLoader.DelegateBossHeadRotation)Delegate.CreateDelegate(typeof(NPCLoader.DelegateBossHeadRotation), g, methodof(GlobalNPC.BossHeadRotation(NPC, float*))));

		// Token: 0x0400161C RID: 5660
		private static NPCLoader.HookList HookBossHeadSpriteEffects = NPCLoader.AddHook<NPCLoader.DelegateBossHeadSpriteEffects>((GlobalNPC g) => (NPCLoader.DelegateBossHeadSpriteEffects)Delegate.CreateDelegate(typeof(NPCLoader.DelegateBossHeadSpriteEffects), g, methodof(GlobalNPC.BossHeadSpriteEffects(NPC, SpriteEffects*))));

		// Token: 0x0400161D RID: 5661
		private static NPCLoader.HookList HookGetAlpha = NPCLoader.AddHook<Func<NPC, Color, Color?>>((GlobalNPC g) => (Func<NPC, Color, Color?>)Delegate.CreateDelegate(typeof(Func<NPC, Color, Color?>), g, methodof(GlobalNPC.GetAlpha(NPC, Color))));

		// Token: 0x0400161E RID: 5662
		private static NPCLoader.HookList HookDrawEffects = NPCLoader.AddHook<NPCLoader.DelegateDrawEffects>((GlobalNPC g) => (NPCLoader.DelegateDrawEffects)Delegate.CreateDelegate(typeof(NPCLoader.DelegateDrawEffects), g, methodof(GlobalNPC.DrawEffects(NPC, Color*))));

		// Token: 0x0400161F RID: 5663
		private static NPCLoader.HookList HookPreDraw = NPCLoader.AddHook<Func<NPC, SpriteBatch, Color, bool>>((GlobalNPC g) => (Func<NPC, SpriteBatch, Color, bool>)Delegate.CreateDelegate(typeof(Func<NPC, SpriteBatch, Color, bool>), g, methodof(GlobalNPC.PreDraw(NPC, SpriteBatch, Color))));

		// Token: 0x04001620 RID: 5664
		private static NPCLoader.HookList HookPostDraw = NPCLoader.AddHook<Action<NPC, SpriteBatch, Color>>((GlobalNPC g) => (Action<NPC, SpriteBatch, Color>)Delegate.CreateDelegate(typeof(Action<NPC, SpriteBatch, Color>), g, methodof(GlobalNPC.PostDraw(NPC, SpriteBatch, Color))));

		// Token: 0x04001621 RID: 5665
		private static NPCLoader.HookList HookDrawHealthBar = NPCLoader.AddHook<NPCLoader.DelegateDrawHealthBar>((GlobalNPC g) => (NPCLoader.DelegateDrawHealthBar)Delegate.CreateDelegate(typeof(NPCLoader.DelegateDrawHealthBar), g, methodof(GlobalNPC.DrawHealthBar(NPC, byte, float*, Vector2*))));

		// Token: 0x04001622 RID: 5666
		private static NPCLoader.HookList HookEditSpawnRate = NPCLoader.AddHook<NPCLoader.DelegateEditSpawnRate>((GlobalNPC g) => (NPCLoader.DelegateEditSpawnRate)Delegate.CreateDelegate(typeof(NPCLoader.DelegateEditSpawnRate), g, methodof(GlobalNPC.EditSpawnRate(Player, int*, int*))));

		// Token: 0x04001623 RID: 5667
		private static NPCLoader.HookList HookEditSpawnRange = NPCLoader.AddHook<NPCLoader.DelegateEditSpawnRange>((GlobalNPC g) => (NPCLoader.DelegateEditSpawnRange)Delegate.CreateDelegate(typeof(NPCLoader.DelegateEditSpawnRange), g, methodof(GlobalNPC.EditSpawnRange(Player, int*, int*, int*, int*))));

		// Token: 0x04001624 RID: 5668
		private static NPCLoader.HookList HookEditSpawnPool = NPCLoader.AddHook<Action<Dictionary<int, float>, NPCSpawnInfo>>((GlobalNPC g) => (Action<Dictionary<int, float>, NPCSpawnInfo>)Delegate.CreateDelegate(typeof(Action<Dictionary<int, float>, NPCSpawnInfo>), g, methodof(GlobalNPC.EditSpawnPool(IDictionary<int, float>, NPCSpawnInfo))));

		// Token: 0x04001625 RID: 5669
		private static NPCLoader.HookList HookSpawnNPC = NPCLoader.AddHook<Action<int, int, int>>((GlobalNPC g) => (Action<int, int, int>)Delegate.CreateDelegate(typeof(Action<int, int, int>), g, methodof(GlobalNPC.SpawnNPC(int, int, int))));

		// Token: 0x04001626 RID: 5670
		private static NPCLoader.HookList HookGetChat = NPCLoader.AddHook<NPCLoader.DelegateGetChat>((GlobalNPC g) => (NPCLoader.DelegateGetChat)Delegate.CreateDelegate(typeof(NPCLoader.DelegateGetChat), g, methodof(GlobalNPC.GetChat(NPC, string*))));

		// Token: 0x04001627 RID: 5671
		private static NPCLoader.HookList HookSetupShop = NPCLoader.AddHook<NPCLoader.DelegateSetupShop>((GlobalNPC g) => (NPCLoader.DelegateSetupShop)Delegate.CreateDelegate(typeof(NPCLoader.DelegateSetupShop), g, methodof(GlobalNPC.SetupShop(int, Chest, int*))));

		// Token: 0x04001628 RID: 5672
		private static NPCLoader.HookList HookSetupTravelShop = NPCLoader.AddHook<NPCLoader.DelegateSetupTravelShop>((GlobalNPC g) => (NPCLoader.DelegateSetupTravelShop)Delegate.CreateDelegate(typeof(NPCLoader.DelegateSetupTravelShop), g, methodof(GlobalNPC.SetupTravelShop(int[], int*))));

		// Token: 0x04001629 RID: 5673
		private static NPCLoader.HookList HookBuffTownNPC = NPCLoader.AddHook<NPCLoader.DelegateBuffTownNPC>((GlobalNPC g) => (NPCLoader.DelegateBuffTownNPC)Delegate.CreateDelegate(typeof(NPCLoader.DelegateBuffTownNPC), g, methodof(GlobalNPC.BuffTownNPC(float*, int*))));

		// Token: 0x0400162A RID: 5674
		private static NPCLoader.HookList HookTownNPCAttackStrength = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackStrength>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackStrength)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackStrength), g, methodof(GlobalNPC.TownNPCAttackStrength(NPC, int*, float*))));

		// Token: 0x0400162B RID: 5675
		private static NPCLoader.HookList HookTownNPCAttackCooldown = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackCooldown>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackCooldown)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackCooldown), g, methodof(GlobalNPC.TownNPCAttackCooldown(NPC, int*, int*))));

		// Token: 0x0400162C RID: 5676
		private static NPCLoader.HookList HookTownNPCAttackProj = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackProj>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackProj)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackProj), g, methodof(GlobalNPC.TownNPCAttackProj(NPC, int*, int*))));

		// Token: 0x0400162D RID: 5677
		private static NPCLoader.HookList HookTownNPCAttackProjSpeed = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackProjSpeed>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackProjSpeed)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackProjSpeed), g, methodof(GlobalNPC.TownNPCAttackProjSpeed(NPC, float*, float*, float*))));

		// Token: 0x0400162E RID: 5678
		private static NPCLoader.HookList HookTownNPCAttackShoot = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackShoot>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackShoot)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackShoot), g, methodof(GlobalNPC.TownNPCAttackShoot(NPC, bool*))));

		// Token: 0x0400162F RID: 5679
		private static NPCLoader.HookList HookTownNPCAttackMagic = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackMagic>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackMagic)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackMagic), g, methodof(GlobalNPC.TownNPCAttackMagic(NPC, float*))));

		// Token: 0x04001630 RID: 5680
		private static NPCLoader.HookList HookTownNPCAttackSwing = NPCLoader.AddHook<NPCLoader.DelegateTownNPCAttackSwing>((GlobalNPC g) => (NPCLoader.DelegateTownNPCAttackSwing)Delegate.CreateDelegate(typeof(NPCLoader.DelegateTownNPCAttackSwing), g, methodof(GlobalNPC.TownNPCAttackSwing(NPC, int*, int*))));

		// Token: 0x04001631 RID: 5681
		private static NPCLoader.HookList HookDrawTownAttackGun = NPCLoader.AddHook<NPCLoader.DelegateDrawTownAttackGun>((GlobalNPC g) => (NPCLoader.DelegateDrawTownAttackGun)Delegate.CreateDelegate(typeof(NPCLoader.DelegateDrawTownAttackGun), g, methodof(GlobalNPC.DrawTownAttackGun(NPC, float*, int*, int*))));

		// Token: 0x04001632 RID: 5682
		private static NPCLoader.HookList HookDrawTownAttackSwing = NPCLoader.AddHook<NPCLoader.DelegateDrawTownAttackSwing>((GlobalNPC g) => (NPCLoader.DelegateDrawTownAttackSwing)Delegate.CreateDelegate(typeof(NPCLoader.DelegateDrawTownAttackSwing), g, methodof(GlobalNPC.DrawTownAttackSwing(NPC, Texture2D*, int*, float*, Vector2*))));

		// Token: 0x02000213 RID: 531
		private class HookList
		{
			// Token: 0x0600177E RID: 6014 RVA: 0x00011C26 File Offset: 0x0000FE26
			public HookList(MethodInfo method)
			{
				this.method = method;
			}

			// Token: 0x04001633 RID: 5683
			public GlobalNPC[] arr = new GlobalNPC[0];

			// Token: 0x04001634 RID: 5684
			public readonly MethodInfo method;
		}

		// Token: 0x02000214 RID: 532
		// (Invoke) Token: 0x06001780 RID: 6016
		private delegate void DelegateUpdateLifeRegen(NPC npc, ref int damage);

		// Token: 0x02000215 RID: 533
		// (Invoke) Token: 0x06001784 RID: 6020
		private delegate bool DelegateCanHitPlayer(NPC npc, Player target, ref int cooldownSlot);

		// Token: 0x02000216 RID: 534
		// (Invoke) Token: 0x06001788 RID: 6024
		private delegate void DelegateModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit);

		// Token: 0x02000217 RID: 535
		// (Invoke) Token: 0x0600178C RID: 6028
		private delegate void DelegateModifyHitNPC(NPC npc, NPC target, ref int damage, ref float knockback, ref bool crit);

		// Token: 0x02000218 RID: 536
		// (Invoke) Token: 0x06001790 RID: 6032
		private delegate void DelegateModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit);

		// Token: 0x02000219 RID: 537
		// (Invoke) Token: 0x06001794 RID: 6036
		private delegate void DelegateModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection);

		// Token: 0x0200021A RID: 538
		// (Invoke) Token: 0x06001798 RID: 6040
		private delegate bool DelegateStrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit);

		// Token: 0x0200021B RID: 539
		// (Invoke) Token: 0x0600179C RID: 6044
		private delegate void DelegateBossHeadSlot(NPC npc, ref int index);

		// Token: 0x0200021C RID: 540
		// (Invoke) Token: 0x060017A0 RID: 6048
		private delegate void DelegateBossHeadRotation(NPC npc, ref float rotation);

		// Token: 0x0200021D RID: 541
		// (Invoke) Token: 0x060017A4 RID: 6052
		private delegate void DelegateBossHeadSpriteEffects(NPC npc, ref SpriteEffects spriteEffects);

		// Token: 0x0200021E RID: 542
		// (Invoke) Token: 0x060017A8 RID: 6056
		private delegate void DelegateDrawEffects(NPC npc, ref Color drawColor);

		// Token: 0x0200021F RID: 543
		// (Invoke) Token: 0x060017AC RID: 6060
		private delegate bool? DelegateDrawHealthBar(NPC npc, byte bhPosition, ref float scale, ref Vector2 position);

		// Token: 0x02000220 RID: 544
		// (Invoke) Token: 0x060017B0 RID: 6064
		private delegate void DelegateEditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns);

		// Token: 0x02000221 RID: 545
		// (Invoke) Token: 0x060017B4 RID: 6068
		private delegate void DelegateEditSpawnRange(Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY);

		// Token: 0x02000222 RID: 546
		// (Invoke) Token: 0x060017B8 RID: 6072
		private delegate void DelegateGetChat(NPC npc, ref string chat);

		// Token: 0x02000223 RID: 547
		// (Invoke) Token: 0x060017BC RID: 6076
		private delegate void DelegateSetupShop(int type, Chest shop, ref int nextSlot);

		// Token: 0x02000224 RID: 548
		// (Invoke) Token: 0x060017C0 RID: 6080
		private delegate void DelegateSetupTravelShop(int[] shop, ref int nextSlot);

		// Token: 0x02000225 RID: 549
		// (Invoke) Token: 0x060017C4 RID: 6084
		private delegate void DelegateBuffTownNPC(ref float damageMult, ref int defense);

		// Token: 0x02000226 RID: 550
		// (Invoke) Token: 0x060017C8 RID: 6088
		private delegate void DelegateTownNPCAttackStrength(NPC npc, ref int damage, ref float knockback);

		// Token: 0x02000227 RID: 551
		// (Invoke) Token: 0x060017CC RID: 6092
		private delegate void DelegateTownNPCAttackCooldown(NPC npc, ref int cooldown, ref int randExtraCooldown);

		// Token: 0x02000228 RID: 552
		// (Invoke) Token: 0x060017D0 RID: 6096
		private delegate void DelegateTownNPCAttackProj(NPC npc, ref int projType, ref int attackDelay);

		// Token: 0x02000229 RID: 553
		// (Invoke) Token: 0x060017D4 RID: 6100
		private delegate void DelegateTownNPCAttackProjSpeed(NPC npc, ref float multiplier, ref float gravityCorrection, ref float randomOffset);

		// Token: 0x0200022A RID: 554
		// (Invoke) Token: 0x060017D8 RID: 6104
		private delegate void DelegateTownNPCAttackShoot(NPC npc, ref bool inBetweenShots);

		// Token: 0x0200022B RID: 555
		// (Invoke) Token: 0x060017DC RID: 6108
		private delegate void DelegateTownNPCAttackMagic(NPC npc, ref float auraLightMultiplier);

		// Token: 0x0200022C RID: 556
		// (Invoke) Token: 0x060017E0 RID: 6112
		private delegate void DelegateTownNPCAttackSwing(NPC npc, ref int itemWidth, ref int itemHeight);

		// Token: 0x0200022D RID: 557
		// (Invoke) Token: 0x060017E4 RID: 6116
		private delegate void DelegateDrawTownAttackGun(NPC npc, ref float scale, ref int item, ref int closeness);

		// Token: 0x0200022E RID: 558
		// (Invoke) Token: 0x060017E8 RID: 6120
		private delegate void DelegateDrawTownAttackSwing(NPC npc, ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset);
	}
}
